package api.txSplash;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.fragment.app.FragmentActivity;

import java.lang.ref.SoftReference;

public abstract class Splash_API_KS {

    public static String clazz = "com.dotools.kslibrary.KS_Splash";

    private static SoftReference<Splash_API_KS> sf;

    public synchronized static Splash_API_KS getInstance() {

        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                sf = new SoftReference<>((Splash_API_KS) o);
                return (Splash_API_KS) o;
            }
        }
        return sf == null ? null : sf.get();
    }

    public abstract void loadSplashKS(ViewGroup view, long adposid, SplashListener listener);


    public interface SplashListener {

        void onLoaded();

        void onPresent();

        void onSkipped();

        void onDismissed();

        void onFailed(int code, String msg);

        void onClick();

        void onDownloadTipsShow();

        void onDownloadTipsDismiss();

        void onDownloadTipsCancel();
    }
}
